Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raster Scanning Code #55

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Raster Scanning Code #55

wants to merge 1 commit into from

Conversation

GlennZZY
Copy link

Uploaded the code for raster scanning.

Since there's only one registry for simulation, the flag might not work at this moment

@@ -146,6 +151,7 @@ class Scope(Recorder):
factory=list, repr=False, init=False
)
"""relative expression levels of neurons selected from each injection"""
Registry: DeviceInteractionRegistry = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we need to store the registry when we can just do registry_for_sim(self.sim)?

@@ -291,6 +297,8 @@ def connect_to_neuron_group(self, neuron_group: NeuronGroup, **kwparams) -> None
self.sigma_per_injct.append(sigma_noise)
self.focus_coords_per_injct.append(focus_coords)
self.rho_rel_per_injct.append(rho_rel)
self.Registry = registry_for_sim(self.sim)
self.Registry.update_fov(self.img_width)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would this need to be updated on every injection? Also, it can't be right that there's a single update_fov for the whole registry, since this should vary for each light device

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Scope should optionally have an imaging_light object, and the img_width and scan_freq would be updated specific to that light

@@ -46,11 +50,21 @@ class DeviceInteractionRegistry:
"""Set of (light, light-dependent device, neuron group) tuples representing
previously created connections."""

raster_fov: int = field(default=500 * 1e-6 * meter, kw_only=True)

raster_enable: int = field(default=0, kw_only=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, these would be at the level of individual lights, not the whole registry

@@ -294,6 +294,8 @@ class Light(Stimulator):
wavelength: Quantity = field(default=473 * nmeter, kw_only=True)
"""light wavelength with unit (usually nmeter)"""

scan_freq : int = field(default=30, kw_only=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd create a subclass RasterScanningLight to hide the scan_freq details from the typical Light object

@@ -104,6 +118,10 @@ def connect_light_to_ldd_for_ng(
i_source = self.subgroup_idx_for_light[light]
light_prop_syn.epsilon[i_source, :] = epsilon
light_prop_syn.T[i_source, :] = light.transmittance(coords_from_ng(ng)).ravel()
light_prop_syn.scan_period = second / light.scan_freq
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd put these in a separate function that you call both here (on injection) and when you change the params on the scope/imaging light (setter functions). like update_raster_scan_params(scope) or something like that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like you've already done with update_fov but can include these other variables too

@kjohnsen kjohnsen assigned kjohnsen and GlennZZY and unassigned kjohnsen Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants